﻿#include "customWrapperedFunc.h"
#include "SketchLayoutIncludes/SketchLayoutAlgo.h"
#include "VFAdapterAPIs.h"
#include <QDebug>
void layoutWrapper(std::vector<Parameter> &in, std::vector<Parameter> &out)
{
    double offsetX=std::any_cast<double>(in[0].value);
    double offsetY=std::any_cast<double>(in[0].value);
    double gapX=std::any_cast<double>(in[0].value);
    double gapY=std::any_cast<double>(in[0].value);
    layoutFunction(offsetX,offsetY,gapX,gapY);
}




void createPointWrapper(std::vector<Parameter> &in, std::vector<Parameter> &out)
{
    double x=std::any_cast<double>(in[0].value);
    double y=std::any_cast<double>(in[1].value);
    double z=std::any_cast<double>(in[2].value);
    const char* pointID=new char[100];
    vfCreatePoint(x,y,z,pointID);
    out[0].value=pointID;

}



void removeTargetObjectWrapper(std::vector<Parameter> &in, std::vector<Parameter> &out)
{
    const char* id=std::any_cast<const char*>(in[0].value);
    vfRemoveTargetObject(id);
}




std::string getObjectIntValue1(const std::wstring &objectName)
{
    std::stringstream ss;
    ss.imbue(std::locale("c"));
    for(wchar_t ch:objectName){
        ss<<static_cast<int>(ch);
    }
    return ss.str();
}

void getCoordOfPointWrapper(std::vector<Parameter> &in, std::vector<Parameter> &out)
{
    char* pointID=new char[100];
    std::string str="288574649";
    strcpy(pointID,str.c_str());
    const char* id=const_cast<const char*>(pointID);
    double x=0;
    double y=0;
    double z=0;
    vfGetCoordOfPoint(id,x,y,z);
    out[0].value=x;
    out[1].value=y;
    out[2].value=z;
}

void deletePointWrapper(std::vector<Parameter> &in, std::vector<Parameter> &out)
{
    const char* pointID=std::any_cast<const char*>(in[0].value);
    vfRemoveTargetObject(pointID);
}

void getSurfaceArea(std::vector<Parameter> &in, std::vector<Parameter> &out)
{
    const char* SurfaceID=std::any_cast<const char*>(in[0].value);
    double temp;
    vfSurfaceArea(SurfaceID,temp);
    out[0].value=temp;
}
